package com.nuoniu.sibanyun.controller.crm.call;


import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.crm.call.CrmCallVoice;
import com.nuoniu.sibanyun.entity.crm.call.dto.CrmCallVoiceSearchDto;
import com.nuoniu.sibanyun.service.crm.call.ICrmCallVoiceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * <p>
 * 客户管理-外呼管理-语音 前端控制器
 * </p>
 *
 * @author 白强
 * @since 2022-02-28
 */
@RestController
@RequestMapping("/crm/callVoice")
@Api(tags = "客户管理-外呼管理-语音")
public class CrmCallVoiceController extends BaseController {

    @Autowired
    private ICrmCallVoiceService voiceService;


    @PostMapping("pageList")
    @ApiOperation(value = "分页查询 ")
    public HttpResult pageList(@RequestBody CrmCallVoiceSearchDto crmCallVoiceSearchDto) {
        return HttpResult.ok(voiceService.pageList(crmCallVoiceSearchDto));
    }

    @PostMapping("saveVoice")
    @ApiOperation(value = "保存")
    public HttpResult saveVoice(@RequestBody CrmCallVoice crmCallVoice){
        voiceService.saveVoice(crmCallVoice);
        return HttpResult.ok();
    }

    @PostMapping("uploadVoice")
    @ApiOperation(value = "上传语音")
    public HttpResult uploadVoice(MultipartFile[] file){
        return HttpResult.ok(voiceService.uploadVoice(file));
    }

    @DeleteMapping("delete")
    @ApiOperation(value = "删除 语音")
    public HttpResult delete(Long id){
        voiceService.delete(id);
        return HttpResult.ok();
    }


}
